]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid/iconGridLayout: Simplify _findBestIconSize()
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 1 Dec 2020 20:58:09 +0000 (17:58 -0300)
committerMarge Bot <marge-bot@gnome.org>
Wed, 2 Dec 2020 22:43:04 +0000 (22:43 +0000)
The 'bestSize' variable isn't necessary anymore, remove it in favor of
simply returning the 'size' or, if no suitable size found, IconSize.TINY.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1518>

js/ui/iconGrid.js

index 93fc6219fa5d6a3406b49f4a2d20609645161cd1..093815922c49a8fafc45273a0e59f2eb1f927a1e 100644 (file)
@@ -403,7 +403,6 @@ var IconGridLayout = GObject.registerClass({
         if (this._fixedIconSize !== -1)
             return this._fixedIconSize;
 
-        let bestSize;
         const iconSizes = Object.values(IconSize).sort((a, b) => b - a);
         for (const size of iconSizes) {
             let usedWidth, usedHeight;
@@ -429,13 +428,11 @@ var IconGridLayout = GObject.registerClass({
                 this._pageHeight - usedHeight -  rowSpacingPerPage -
                 this._pagePadding.top - this._pagePadding.bottom;
 
-            bestSize = size;
-
             if (emptyHSpace >= 0 && emptyVSpace > 0)
-                break;
+                return size;
         }
 
-        return bestSize;
+        return IconSize.TINY;
     }
 
     _getChildrenMaxSize() {